import request  from '@/utils/request';

import { BASE_URL } from '@/config/query';

export async function queryPage(params = { pageSize: 10, pageNum: 0 }) {
  return request(`${BASE_URL}/position/page`, params)
}

export async function queryInfoById(id) {
  return request(`${BASE_URL}/position/detail/${id}`)
}

export async function create(params) {
  return request(`${BASE_URL}/position/create`, params)
}

export async function update(params) {
  return request(`${BASE_URL}/position/modify`, params)
}

export async function lock(id) {
  return request(`${BASE_URL}/position/remove/${id}`)
}

export async function remove(id) {
  return request(`${BASE_URL}/position/remove/${id}`)
}

export async function queryList(params) {
  return request(`${BASE_URL}/build/list`, params)
}

// 启用或停用巡逻点
export async function optionEnable(params) {
  return request(`${BASE_URL}/position/enable`, params)
}

export async function detailLocationPlan(id) {
  return request(`${BASE_URL}/floor_plan/detail/${id}`)
}

export async function queryLocation({ tail, ...res }) {
  return request(`${BASE_URL}/${tail}/list`, res)
}

export async function queryFloorById(id) {
  return request(`${BASE_URL}/floor_plan/detail/${id}`)
}
